package dnem;


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.util.concurrent.TimeUnit;

public class Pagedelete {
    private WebDriver driver;
    public Pagedelete (WebDriver driver) throws InterruptedException {
        driver.findElement(By.cssSelector(".drpdwnHandler")).click();
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.xpath("//div[contains(text(),'Profile')]")).click();
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.xpath(".//a[text() = 'Delete account']")).click();
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.xpath(".//a [text() = 'Yes, delete my account']")).click();
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.cssSelector(".ttMargin>input")).click();
        driver.findElement(By.cssSelector(".ttMargin>input")).sendKeys("yarik.zavik");
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.cssSelector(".ttMargin>textarea")).click();
        driver.findElement(By.cssSelector(".ttMargin>textarea")).sendKeys("yarik.zavik");
        TimeUnit.SECONDS.sleep(4);
        driver.findElement(By.xpath(".//a[text()='Delete my account']")).click();
        TimeUnit.SECONDS.sleep(4);
        String text=driver.findElement(By.xpath(".//a[text() = 'Login']")).getText();
        if (text.equals("Login"))
        {
            System.out.println("Я удалил аккаунт и все тесты прошли");
        }
        else
        {
            System.out.println("Я не удалился");
        }
    }
}
